extends Node2D

var sound
var type="diamond"
var pos:Vector2i
var layer:TileMapLayer
var heart

func _ready() -> void:
	heart=get_tree().get_first_node_in_group("heart")
	sound=get_tree().get_first_node_in_group("sound")

func _setting(set_pos,set_layer):
	pos=set_pos
	layer=set_layer
	self.global_position=layer.map_to_local(pos)

func _physics_process(delta: float) -> void:
	if heart.pos==pos:
		global.diamond+=1
		sound.play()
		self.queue_free()
	
